<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<script type="text/javascript">
			var re = 0;
			var isIl = true;
			var opa = window.prompt("请输入运算符--\"+\",\"-\",\"x\",\"/\"", "");
			var num1 = window.prompt("请输入第一个数字");
			while(isNaN(num1) == true) {
				num1 = window.prompt("您输入的不是数字，请重新输入");
			}
			num1 = parseFloat(num1);
			var num2 = window.prompt("请输入第二个数字");
			while(isNaN(num2) == true) {
				num2 = window.prompt("您输入的不是数字，请重新输入");
			}
			num2 = parseFloat(num2);
			switch(opa) {
				case "+":
					re = num1 + num2;
					break;
				case "-":
					re = num1 - num2;
					break;
				case "x":
					re = num1 * num2;
					break;
				case "/":
					if(num2 == 0) {
						isIl = false;
					} else {
						re = num1 / num2;
					}
					break;
			}
			if(isIl == true) {
				document.write(num1 + "" + opa + "" + num2 + "=" + re);
			} else {
				document.write("除数不能为0");
			}
		</script>
	</body>

</html>